package com.yonyou.ucf.mdf.app.isvdxq.firstpart.location.mapper;

import com.yonyou.ucf.mdf.app.isvdxq.firstpart.location.entity.OrderNoticeEntity;
import org.apache.ibatis.jdbc.SQL;

public class OrderNoticeSqlProvider {
    public String insertSelective(OrderNoticeEntity record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("dxq_ordernotice");

        if (record.getId() != null) {
            sql.VALUES("`id`", "#{id,jdbcType=INTEGER}");
        }

        if (record.getType() != null) {
            sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
        }

        if (record.getActioncode() != null) {
            sql.VALUES("`actioncode`", "#{actioncode,jdbcType=VARCHAR}");
        }

        if (record.getTranstype() != null) {
            sql.VALUES("`transtype`", "#{transtype,jdbcType=VARCHAR}");
        }

        if (record.getOrderid() != null) {
            sql.VALUES("`orderid`", "#{orderid,jdbcType=VARCHAR}");
        }

        if (record.getOrdercode() != null) {
            sql.VALUES("`ordercode`", "#{ordercode,jdbcType=VARCHAR}");
        }

        if (record.getOrderdetailids() != null) {
            sql.VALUES("`orderdetailids`", "#{orderdetailids,jdbcType=VARCHAR}");
        }

        if (record.getSourceid() != null) {
            sql.VALUES("`sourceid`", "#{sourceid,jdbcType=VARCHAR}");
        }

        if (record.getSourcecode() != null) {
            sql.VALUES("`sourcecode`", "#{sourcecode,jdbcType=VARCHAR}");
        }

        if (record.getSourcedetailids() != null) {
            sql.VALUES("`sourcedetailids`", "#{sourcedetailids,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourceid() != null) {
            sql.VALUES("`firstsourceid`", "#{firstsourceid,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourcecode() != null) {
            sql.VALUES("`firstsourcecode`", "#{firstsourcecode,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourcedetailids() != null) {
            sql.VALUES("`firstsourcedetailids`", "#{firstsourcedetailids,jdbcType=VARCHAR}");
        }

        if (record.getStatus() != null) {
            sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
        }

        if (record.getTenant_id() != null) {
            sql.VALUES("`ytenant_id`", "#{tenant_id,jdbcType=VARCHAR}");
        }

        if (record.getCreator() != null) {
            sql.VALUES("`creator`", "#{creator,jdbcType=VARCHAR}");
        }

        if (record.getModifier() != null) {
            sql.VALUES("`modifier`", "#{modifier,jdbcType=VARCHAR}");
        }

        if (record.getPickbatchno() != null) {
            sql.VALUES("`pickbatchno`", "#{pickbatchno,jdbcType=VARCHAR}");
        }
        if (record.getAuditstatus() != null) {
            sql.VALUES("`auditstatus`", "#{auditstatus,jdbcType=INTEGER}");
        }
        if (record.getRepickstatus() != null) {
            sql.VALUES("`repickstatus`", "#{repickstatus,jdbcType=INTEGER}");
        }
        if (record.getRemark() != null) {
            sql.VALUES("`remark`", "#{remark,jdbcType=VARCHAR}");
        }
        if (record.getRemarkdxq() != null) {
            sql.VALUES("`remarkdxq`", "#{remarkdxq,jdbcType=VARCHAR}");
        }
        if (record.getRemarkyonyou() != null) {
            sql.VALUES("`remarkyonyou`", "#{remarkyonyou,jdbcType=VARCHAR}");
        }

        return sql.toString();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NewTable
     *
     * @mbg.generated Mon Mar 07 07:40:31 UTC 2022
     */
    public String updateByPrimaryKeySelective(OrderNoticeEntity record) {
        SQL sql = new SQL();
        sql.UPDATE("dxq_ordernotice");

        if (record.getType() != null) {
            sql.SET("`type` = #{type,jdbcType=INTEGER}");
        }

        if (record.getActioncode() != null) {
            sql.SET("`actioncode` = #{actioncode,jdbcType=VARCHAR}");
        }

        if (record.getTranstype() != null) {
            sql.SET("`transtype` = #{transtype,jdbcType=VARCHAR}");
        }

        if (record.getOrderid() != null) {
            sql.SET("`orderid` = #{orderid,jdbcType=VARCHAR}");
        }

        if (record.getOrdercode() != null) {
            sql.SET("`ordercode` = #{ordercode,jdbcType=VARCHAR}");
        }

        if (record.getOrderdetailids() != null) {
            sql.SET("`orderdetailids` = #{orderdetailids,jdbcType=VARCHAR}");
        }

        if (record.getSourceid() != null) {
            sql.SET("`sourceid` = #{sourceid,jdbcType=VARCHAR}");
        }

        if (record.getSourcecode() != null) {
            sql.SET("`sourcecode` = #{sourcecode,jdbcType=VARCHAR}");
        }

        if (record.getSourcedetailids() != null) {
            sql.SET("`sourcedetailids` = #{sourcedetailids,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourceid() != null) {
            sql.SET("`firstsourceid` = #{firstsourceid,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourcecode() != null) {
            sql.SET("`firstsourcecode` = #{firstsourcecode,jdbcType=VARCHAR}");
        }

        if (record.getFirstsourcedetailids() != null) {
            sql.SET("`firstsourcedetailids` = #{firstsourcedetailids,jdbcType=VARCHAR}");
        }

        if (record.getStatus() != null) {
            sql.SET("`status` = #{status,jdbcType=INTEGER}");
        }

        sql.SET("`dr` = #{dr,jdbcType=INTEGER}");

//        if (record.getTenant_id() != null) {
//            sql.SET("`ytenant_id` = #{tenant_id,jdbcType=VARCHAR}");
//        }

        if (record.getCreator() != null) {
            sql.SET("`creator` = #{creator,jdbcType=VARCHAR}");
        }

        if (record.getModifier() != null) {
            sql.SET("`modifier` = #{modifier,jdbcType=VARCHAR}");
        }

        if (record.getPickbatchno() != null) {
            sql.VALUES("`pickbatchno`", "#{pickbatchno,jdbcType=VARCHAR}");
        }
        if (record.getAuditstatus() != null) {
            sql.VALUES("`auditstatus`", "#{auditstatus,jdbcType=INTEGER}");
        }
        if (record.getRepickstatus() != null) {
            sql.VALUES("`repickstatus`", "#{repickstatus,jdbcType=INTEGER}");
        }

        sql.WHERE("`id` = #{id,jdbcType=INTEGER}");

        return sql.toString();
    }
}
